let express = require('express');
let app = express();
app.use(express.json());
app.use(express.urlencoded({
    extended: false
}));
let loginRouter = require('./routes/login');
let registerRouter = require('./routes/register');
let dropDataRouter = require('./routes/dropdownData');
let submitForm = require('./routes/submitForm');
const cors = require('cors');
app.use(cors({ origin: "*"}));
app.all('*', function (req, res, next) {
    res.header('Access-Control-Allow-Origin', '*');
    res.header('Access-Control-Allow-Credentials', true);
    res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
    next();
});
//登录路由
app.use('/' ,loginRouter);
app.use('/' ,registerRouter);
app.use('/' ,dropDataRouter);
app.use('/' ,submitForm);
app.listen(3000, function () {
    console.log('success')
})
